<script setup lang="ts">
import {useRouter}  from "vue-router";
import CheckPassword from "./checkPassword.vue";
import ShowFIle from "./ShowFIle.vue";
import { getUserShareFIleDataApi} from './api/ShareFile.ts'

import { reShareFileType} from '../components/operation/FileApi.ts'

import {onMounted,ref,Ref} from "vue";

let router=useRouter();


let data:Ref<reShareFileType>=ref({});
const getData=()=>{
  getUserShareFIleDataApi(uuid).then(res=>{
  if(res.code=='00000'){
      data.value=res.data
  }
  })
}
let uuid=router.currentRoute.value.params.uuid


//控制组件显示

let show=ref(true)

const changeShow=(e:boolean)=>{
  show.value=e;
}
onMounted(()=>{
  getData()
})

</script>

<template>
  <CheckPassword @show="changeShow"  :password="data.sharePassword" :username="data.shareUserName" v-if="show"/>
  <ShowFIle  :fid="data.shareFileId" :username="data.shareUserName" :uid="data.shareUserId" :type="data.shareFileType" v-else/>
</template>

<style scoped>

</style>